<include file="Public:_head" />
<include file="Public:left" />

	<div id="neirong">
	<!--  <h2 class="lm_title">自定义回复 </h2>-->
        <div id="Diy_huifu">
		 <h3 class="subTitle"><img src="com_statics/images/icon_12.gif" alt="图片描述" style="left:18px;" />自定义回复<span>通过自定义回复，可以快捷为求职者提供固定模式的答案！</span></h3>
            <ul class="fnNav">
                <li><a href="javascript:void(0)" id="add_txtkey">添加文字关键字</a></li>
                <!--<li><a href="#"  id="add_txtlink">添加链接关键字</a></li>-->
                <li><a href="{:U('Weixin/add_reply_image',array('type'=>1))}">添加单图文关键字</a></li>
                <li><a href="{:U('Weixin/add_reply_image',array('type'=>2))}">添加多图文关键字</a></li>
            </ul>
            <span class="clear"></span>
              <div class="addkey" id="add_txtkeybox">
                <form action="{:U('Weixin/add_reply_word')}" class="form" method="post" onSubmit="return checktxtkey();">
                    <em>关键字（多个关键字请用逗号隔开）<font color="red">*</font></em>
                    <input name="key" type="text" class="text" />
					<em>文字内容 <font color="red">*</font></em>
                    <textarea name="content" cols="" rows=""></textarea>
                    <button class="btn_send" type="submit">提交</button>
                    <button class="btn_esc" type="button">取 消</button>
                </form>
                <span class="jiantou"></span>
            </div>          
              <div class="addkey" id="add_txtlinkbox">
                <form action="" class="form" method="post">
                    <em>关键字（多个关键字请用逗号隔开）</em>
                    <input name="txt" type="text" class="text" /><em>链接地址</em>
                    <textarea name="textarea" cols="" rows=""></textarea>
                    <button class="btn_send" type="submit">提交</button>
                    <button class="btn_esc" type="button">取 消</button>
                </form>
                <span class="jiantou" style="left:229px;"></span>
            </div>          
            <table width="100%"  class="tables"border="0" cellspacing="0" cellpadding="0">
              <tr>
                <th scope="col" width="10%">&nbsp;</th>
                <th scope="col" width="40%">关键字</th>
                <th scope="col" width="20%">类  型</th>
                <th scope="col" width="30%">管理 </th>
              </tr>
			  <volist name="reply.data" id="r">
              <tr>
                <td><input name="checkbox" type="checkbox" value="" /></td>
                <td class="txt_left">{$r.key}
					<if condition="$r.type eq 1">
				    <div class="editkeybox" id="edit_txtkeybox_{$r.reply_id}">
						<form action="{:U('Weixin/edit_reply_word')}" class="form" method="post">
							<em>关键字（多个关键字请用逗号隔开）</em>
							<input name="key" type="text" class="text" value="{$r.key}" />
                            <input name="reply_id" type="hidden" class="text" value="{$r.reply_id}" />
							<em>文字内容</em>
							<textarea name="content" cols="" rows="">{$r.content}</textarea>
							<button class="btn_send" type="submit">提交</button>
							<button class="btn_esc" rate="{$r.reply_id}" type="button">取 消</button>
						</form>
					</div>    
					</if>
				</td>
                <td><eq name="r.type" value="1">文字<else/>图文</eq></td>
                <td><a href="javascript:void(0)" rate="{$r.reply_id}" class="btn_del">删除</a> <switch name="r.type"><case value="1" break="1"><a href="javascript:void(0)" rate="{$r.reply_id}" class="btn_edit keyedit">编辑</a></case><case value="2" break="1"><a href="{:U('Weixin/edit_reply_image',array('reply_id'=>$r['reply_id']))}" class="btn_edit">编辑</a></case></switch> </td>
              </tr>
			  </volist>
            </table>
        </div>
        <!-- Diy_huifu结束 -->
        {$reply.html}
	</div>
	<!-- neirong结束 -->
	<span class="clear"></span>
	<!-- 清除浮动 -->
</div>
<!-- container结束 -->
<script>
function checktxtkey(){
    var val = $("input[name='key']").attr('value');
    var num = $("textarea[name='content']").attr('value');
    if(val ==""){
        alert('关键字不能为空！');
        return false;
    }
    if(num ==""){
        alert('文字内容不能为空！');
        return false;
    }
}
$(document).ready(function(){
    $(".btn_del").click(function(){
        var con = confirm('确定删除该条数据吗？');
        if(con){
        var id = $(this).attr('rate');
        $.post("__URL__/del_reply", { "rid": id},
           function(data){
            if (data.status==1) {
              location.replace(location.href);  }
           }, "json");
        }
    });
	$(".keyedit").click(function(){
		num = $(this).attr('rate');
		$("#edit_txtkeybox_"+num).show();
	});
	$(".editkeybox .btn_esc").click(function(){
		num = $(this).attr('rate');
		$("#edit_txtkeybox_"+num).fadeOut(300)	
	})
});
</script>
<include file="Public:bottom" />